<?php
class expand_modelApi extends baseApi{

	public function hook_menu_expand(){
        return array(
            0 => array('name'=>'扩展模型','url'=>url('admin_category/index'),'sequence'=>0),
            );
    }

    //权限
	public function hook_purview_admin()
    {
        return array(
            'admin_category'=>array(
                'name'=>'扩展模型',
                'auth'=>array(
                	'list'=>'列表',
                    'add'=>'添加',
                    'edit'=>'编辑',
                    'del'=>'删除',
                ),
            ),
            'admin_list'=>array(
                'name'=>'扩展模型字段',
                'auth'=>array(
                	'list'=>'列表',
                    'add'=>'添加',
                    'edit'=>'编辑',
                    'del'=>'删除',
                ),
            ),
        );
    }

	//模型列表
	public function model_list(){
		return model('expand_model')->model_list();
	}

	//模型信息
	public function model_info($mid){
		return model('expand_model')->info($mid);
	}

	//字段类型参数
	public function field_type($data){
		return model('expand_model_field')->field_type($data['id'],$data['name']);
	}

	//字段添加格式化
	public function field_data($data){
		return model('expand_model_field')->field_data($data);
	}

	//获取字段显示
	public function get_list_model($data){
		return model('expand_model_field')->get_list_model($data['type'],$data['str'],$data['config']);
	}

	//获取字段HTML列表
	public function get_field_html($data){
		return model('expand_model_field')->get_layout_html($data['field_info'],$data['data']);
	}


	//获取扩展字段完整html
	public function get_field_content($data){
		return model('expand_model_field')->get_field_content($data['cid'],$data['aid'],$data['html'],$data['external']);
	}

	//处理内容字段格式化
	public function field_in($data){
		return model('expand_model_field')->field_in($data['data'],$data['type'],$data['field']);
	}

	//栏目信息HTML
	public function hook_admin_category_info_html($info=array()){
		echo model('expand_model')->model_list_html($info);
	}

	//内容信息HTML
	public function hook_admin_content_info_foot_html($info=array()){
		echo model('expand_model')->model_info_html($info);
	}

	//内容栏目选择JS
	public function hook_admin_content_info_js_class($info=array()){
		echo model('expand_model')->model_info_js_class($info);
	}

	//检测扩展内容
	public function hook_admin_content_data_check($data){
		return model('expand_model_field')->content_check($data);
	}

	//保存扩展内容
	public function hook_admin_content_save_data($data){
		return model('expand_model_field')->content_save($data);
	}

	//删除扩展内容
	public function hook_admin_content_del_top_data($aid){
		return model('expand_model_field')->content_del($aid);
	}

	//列表扩展模型sql语句
	public function hook_content_list_sql($info=array()){
		return model('expand_model')->model_list_sql($info['expand']);
	}

	//内容扩展SQL
	public function hook_content_info_sql($info=array()){
		return model('expand_model')->model_list_sql($info['expand']);
	}

	//上一篇SQL
	public function hook_content_prev_sql($info=array()){
		return model('expand_model')->model_list_sql($info['expand']);
	}

	//下一篇SQL
	public function hook_content_next_sql($info=array()){
		return model('expand_model')->model_list_sql($info['expand']);
	}

	
}